//
//  SAShopListCell.m
//  YunFu
//
//  Created by Bager on 2018/9/11.
//  Copyright © 2018年 yunfu. All rights reserved.
//

#import "SAShopListCell.h"

@implementation SAShopListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self setViews];
    }
    
    return self;
}

- (void)setViews
{
    [self addSubview:self.img];
    [self addSubview:self.name];
    [self addSubview:self.inBtn];
    [self addSubview:self.score];
    [self addSubview:self.goodsCV];
}

- (UIImageView *)img
{
    if (!_img)
    {
        _img = [[UIImageView alloc] initWithFrame:CGRectMake(kPublicMargin, 5, 30, 30)];
        _img.contentMode = UIViewContentModeScaleAspectFit;
        _img.layer.masksToBounds = YES;
        [_img setImage:[UIImage imageNamed:@"touxiang"]];
    }
    return _img;
}

- (UILabel *)name
{
    if (!_name)
    {
        _name = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.img.frame) + 10, 0, 150, 40)];
        _name.font = [UIFont systemFontOfSize:14];
        _name.adjustsFontSizeToFitWidth = YES;
        _name.text = @"亲亲家园";
    }
    return _name;
}

- (UILabel *)score
{
    if (!_score)
    {
        _score = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.inBtn.frame) - 80, 0, 80, 40)];
        _score.font = [UIFont systemFontOfSize:12];
        _score.textColor = kPublicColorRed;
        _score.text = @"店铺评分 4.5";
    }
    return _score;
}


- (UIButton *)inBtn
{
    if (!_inBtn)
    {
        _inBtn = [[UIButton alloc] init];
        [_inBtn setFrame:CGRectMake(kScreenWidth - kPublicMargin - 70, 8, 70, 24)];
        [_inBtn setTitle:@"进店逛逛" forState:UIControlStateNormal];
        _inBtn.titleLabel.font = [UIFont systemFontOfSize:12];
        _inBtn.backgroundColor = kPublicColorRed;
        _inBtn.layer.cornerRadius = 12;
        _inBtn.layer.masksToBounds = YES;
        [_inBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    }
    return _inBtn;
}

- (SAShopListCollectionView *)goodsCV
{
    if (!_goodsCV)
    {
        _goodsCV = [[SAShopListCollectionView alloc] init];
    }
    return _goodsCV;
}

@end
